package geektime.spring.springbucks;

import geektime.spring.springbucks.service.CoffeeService;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.transaction.annotation.EnableTransactionManagement;

import java.util.Arrays;

@Slf4j
@EnableTransactionManagement
@SpringBootApplication
@MapperScan("geektime.spring.springbucks.repository")
@EnableCaching
public class Task1_Q2_Application implements ApplicationRunner {
	@Autowired
	private CoffeeService coffeeService;

	public static void main(String[] args) {
		SpringApplication.run(Task1_Q2_Application.class, args);
	}

	@Override
	public void run(ApplicationArguments args) throws Exception {


		// 按id集合查找
		coffeeService.findAllByIds(Arrays.asList(1L, 2L, 3L,4L, 5L, 6L,1L, 2L, 3L,1L, 2L, 3L,1L, 2L, 3L));

		coffeeService.findAllByIds(Arrays.asList(1L, 2L, 3L));

	}
}

